package com.example.localbites;

import java.util.List;

import com.example.constants.StringConstant;
import com.example.dbaccess.LocalBitesDB;
import com.example.yelp.service.beans.Business;
import com.example.yelp.service.beans.YelpSearchResult;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class RestaurantList extends Activity 
{
	private ListView listviewRestaurant;
	private Context ctx;
	private StringConstant con = new StringConstant();
	private YelpSearchResult result;
	private TextView headerView;
	private String cusineType;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_list);
		ctx=this;
			
		//Displaying yelp Search List Data
		result = (YelpSearchResult) getIntent().getSerializableExtra(con.SEARCH_RESULT);
		cusineType = getIntent().getStringExtra(con.CUSINE_TYPE);
		
		listviewRestaurant = (ListView) findViewById(R.id.restaurantList);
		headerView = (TextView) findViewById(R.id.txtCusineHeader);
		headerView.setText(cusineType + " " + con.CUSINE_TYPE_STRING);
		
		listviewRestaurant.setAdapter( new RestaurantAdapter(ctx, R.layout.activity_list_row, result.getBusinesses()));
	}
}
